package com.longjianghuasheng.logistics.business.release_record

import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Typeface
import android.os.Bundle
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.base.BaseFragment
import com.longjianghuasheng.logistics.databinding.FragmentReleaseRecordBinding
import com.longjianghuasheng.logistics.eventViewModel
import com.longjianghuasheng.logistics.util.PopUtils

class ReleaseRecordFragment : BaseFragment<ReleaseRecordViewModel, FragmentReleaseRecordBinding>() {

    override fun layoutId(): Int = R.layout.fragment_release_record

    override fun initView(savedInstanceState: Bundle?) {
        initTitleBar()
        mDatabind.run {


            tvStatus.setOnClickListener {

                PopUtils.showPop(tvStatus) { i, str ->


                    tvStatus.text = str
                    eventViewModel.onReleaseStatusEvent.value = i

                }
            }

            btnFilter.setOnClickListener {

                eventViewModel.onReleaseSearchEvent.value = editText.text.toString()

            }

        }

    }

    @SuppressLint("NewApi", "UseCompatTextViewDrawableApis")
    private fun initTitleBar() {
        mDatabind.include.titleBar.run {

            leftText.compoundDrawableTintList = ColorStateList.valueOf(Color.WHITE)

            setTitle("发布记录").centerText.typeface = Typeface.defaultFromStyle(Typeface.BOLD)

            setLeftClickListener {
                navigateUp()
            }
        }
    }

    override fun createObserver() {
        super.createObserver()
    }

    override fun initData() {
        super.initData()
    }

    override fun lazyLoadData() {
        super.lazyLoadData()
    }
}